<template>
  <div>
    <div v-if="props.res">
      <nut-swiper :height="px2rpx(res.data.height) + 'rpx'" :pagination-visible="true" :auto-play="res.data.autoPlay == undefined ? 5000 : res.data.autoPlay * 1000">
        <nut-swiper-item v-for="(item, index) in props.res.data.list" :key="item.id">
          <image
            w-full
            mode="aspectFill"
            :style="{
              height: px2rpx(res.data.height) + 'rpx',
              'border-radius': px2rpx(res.data.round) + 'rpx'
            }"
            :src="item.img"
            alt=""
            @click="clickSwiper(index)"></image>
        </nut-swiper-item>
      </nut-swiper>
    </div>
  </div>
</template>

<script setup lang="ts">
import { px2rpx } from './px2rpx'
import { modelNavigateTo } from './tpl-v3'
const props = defineProps(['res'])

function clickSwiper(index: number) {
  console.log('点击轮播图', index, props.res.data.list[index])
  modelNavigateTo(props.res.data.list[index])
}
</script>

<style scoped></style>
